<?php

namespace App\Services;

use App\Models\Ticket;
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use xmlrpc_client;
use xmlrpcmsg;

class Link
{

    private $error = '';

    /**
     * 获取与中心 UAC 关联数据
     * 
     * @return array
     */
    public function getLinkData()
    {
        $host = request()->getHost();
        $port = request()->getPort();
        $data = [
            'uuid'            => uniqid(),
            'center_host'     => env('CENTER_UAC_HOST', 'platform.xhedu.sh.cn'),
            'center_port'     => env('CENTER_UAC_PORT',
                80),
            'center_sso_path' => env('CENTER_UAC_SSO_PATH', '/platform/rpc/index.k12.php'),
            'center_sso_user' => env('CENTER_UAC_SSO_USER', 'K12RPC'),
            'center_sso_pass' => env('CENTER_UAC_SSO_PASS', 'K12RPCPwd'),
            'center_encoding' => env('CENTER_UAC_ENCODING', 'GBK'),
            'node_name'       => '',
            'node_inner_host' => $host,
            'node_inner_port' => $port,
            'node_outer_host' => $host,
            'node_outer_port' => $port,
            'node_im'         => '',
        ];
        return $data;        
    }

    public function getError()
    {
        return $this->error;
    }
}